#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main()
{
	int n = 0;
	while (scanf("%d", &n) == 1)
	{
		int i, j = 1;
		for (i = 1; i <= n; i++)
		{
			if (i == 1 || i== n)
			{
				for (j = 1; j <= n; j++)
				{
					printf("* ");
				}
			}
			else
			{
				for (j = 1; j <= n; j++)
				{
					if (j == 1 || j == n)
					{
						printf("* ");
					}
					else
					{
						printf("  ");
					}
				}
			}
			printf("\n");
		}
	}
	return 0;
}